/**
 * Created with JetBrains PhpStorm.
 * User: Administrator
 * Date: 13-8-29
 * Time: 下午9:10
 * To change this template use File | Settings | File Templates.
 */
function closeandopen(url){
    var browserName = navigator.appName;
    if (browserName == "Microsoft Internet Explorer") {
        window.opener = null;
        window.open('','_self');
        window.close();
        var myWindow = window.open(url, 'myWindow','resizable=no,location=no,menubar=no,status=yes');
        myWindow.focus();
        myWindow.moveTo(0, 0);
        myWindow.resizeTo(screen.availWidth, screen.availHeight);
        return false;
    }
    window.location.href = url;
}

/**
 * 判断字符是否为空
 * @param string
 * @returns {boolean}
 */
function empty(string){
    if(typeof(string) == 'undefined') return true;
    if(string == '') return true;
    return false;
}

/**
 * 判断函数是否存在
 * @param function_name
 * @returns {boolean}
 */
function function_exists(function_name){
    try{
        if(function_name && typeof(function_name) == 'function') return true;
    }catch (e){}
    return false;
}

/**
 * 创建完整URL
 * @param url
 * @param query
 * @returns {*}
 */
function http_build_query(url, query){
    if($.isEmptyObject(query)) return url;
    query = $.param(query);
    if(url.indexOf('?') > -1) {
        url += '&';
    }else{
        url += '?';
    }
    return url + query;
}

/**
 * 设置对象焦点
 * @param element
 */
function blur(element){
    $(element).blur();
}
